package com.lanzhou.yuanfen.diary.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lanzhou.yuanfen.diary.entity.Article;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.Map;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author lcllge
 * @since 2020-05-23
 */
@Mapper
@Repository
public interface ArticleMapper extends BaseMapper<Article> {

    /**
     * 获取猿粪数据
     *
     * @param userKey 用户ID
     * @return map
     */
    @Select("SELECT COUNT(article_key) wzzs,SUM(likes) zscs,SUM(views) zyds from article WHERE create_by = #{userKey}")
    Map<String, Long> selectYFInfoByUserKey(@Param("userKey") String userKey);
}
